/*****************************************************************************
 * plum_hal_i2s.h
 *
 * Copyright (C) 2020 Jeasonvor 1101627719@qq.com
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 *
 ****************************************************************************/
#ifndef __PLUM_HAL_I2S_H__
#define __PLUM_HAL_I2S_H__

/*****************************************************************************
 * Included Files
 ****************************************************************************/

/*****************************************************************************
 * Pre-processor Definitions
 ****************************************************************************/

/*****************************************************************************
 * Public Types
 ****************************************************************************/

// GPIO引脚
typedef struct {
    plum_u32 clk;
    plum_u32 ws;
    plum_u32 sd;
} plum_hal_i2s_gpio_t;

// I2S格式
typedef enum {
    PLUM_HAL_I2S_FMT_PHILIPS, /** 飞利浦标准 */
    PLUM_HAL_I2S_FMT_LEFT,    /** 左对齐标准 */
    PLUM_HAL_I2S_FMT_RIGHT,   /** 右对齐标准 */
} plum_hal_i2s_fmt_t;

//声道
typedef enum {
    PLUM_HAL_I2S_CHANNEL_LEFT,  /** 左声道 */
    PLUM_HAL_I2S_CHANNEL_RIGHT, /** 右声道 */
} plum_hal_i2s_channel_t;

//配置参数
typedef struct {
    plum_hal_i2s_gpio_t gpio;
    plum_hal_i2s_fmt_t  fmt;
} plum_hal_i2s_cof_t;

/*****************************************************************************
 * Public Data
 ****************************************************************************/

/****************************************************************************/
#ifdef __cplusplus
extern "C" {
#endif
/*****************************************************************************
 * Public Function Prototypes
 ****************************************************************************/

/**
 * @brief:  I2S接口初始化
 *
 * @param[in]:  id          -   I2S ID
 * @param[in]:  config      -   I2S配置指针
 *
 * @return: 返回执行状态
 */
plum_s32 plum_hal_i2s_init(plum_u32 id, plum_hal_i2s_cof_t *config);

/****************************************************************************/
#ifdef __cplusplus
}
#endif
/****************************************************************************/
#endif /* __PLUM_HAL_I2S_H__ */
/****************************************************************************/
/*                                                                          */
/*  End of file.                                                            */
/*                                                                          */
/****************************************************************************/
